﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZEBuz.Questionnaire.Lib.Core
{
    public class LogHelper
    {
        public LogHelper() { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fileNamePrefixKey">日志记录的前缀，用于分类</param>
        public static void Log(string fileNamePrefixKey, params string[] contentList)
        {
            string newLog = "/Logs/" + fileNamePrefixKey + DateTime.Now.Ticks.ToString() + ".log";
            string path = System.Web.HttpContext.Current.Server.MapPath(newLog);
            System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Create);
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, System.Text.Encoding.Default);

            foreach (var content in contentList)
            {
                sw.WriteLine(content);
            }
        }
    }
}
